/*
============================================================================
 Name        : dd_mp3_frame.h
 Author      : Jian
 Version     :
 Copyright   : GPL
 Description : dd_mp3_frame.h - header file
============================================================================
*/

#ifndef DD_MP3_FRAME_H
#define DD_MP3_FRAME_H

#include "dd_define.h"
#include "sd_platform.h"

__DD_BEGIN_DECLS

#define DD_FRAME_HEADER_LEN 4

typedef struct __dd_mp3_first_frame dd_mp3_frame ;
struct __dd_mp3_xing ;
struct __dd_mp3_vbri ;

struct __dd_mp3_first_frame {
    struct __dd_mp3_xing*   xing ;
    struct __dd_mp3_vbri*   vbri ;
    sd_file*                   file ;
    int                     posInFile ; 
    DD_BYTE                 header[DD_FRAME_HEADER_LEN] ;
    sd_semp*                lock ;
};

/* if the first frame is not exist yet, it will return NULL */
dd_mp3_frame* dd_frame_create(sd_file* file, DD_UINT startPos, sd_semp* lock) ;

void dd_frame_destroy(dd_mp3_frame* frame) ;

/* get the nearest frame file pos */
int dd_frame_seek(dd_mp3_frame* frame, int seconds) ;

int dd_frame_get_bitrate(dd_mp3_frame* frame) ;

int dd_frame_get_sample(dd_mp3_frame* frame) ;

/* duration in second */
int dd_frame_get_duration(dd_mp3_frame* frame) ;

__DD_END_DECLS

#endif  /* DD_MP3_FRAME_H */

/* End of File */
